<?php
class Tenant_model extends MY_Model {

	var $business_nature_id = null;
	var $name = null;
	var $description = null;
	var $address = null;
	
	public function __construct() {
		parent::__construct();
	}
	
	public function find_by_name($name) {
		$sql = "SELECT * FROM " . $this->table() . " WHERE valid = ? AND name = ?";
		return $this->db->query($sql, array(1,$name))->result_object();
	}
	
	public function find_by_name_of_others($id, $name) {
		$sql = "SELECT * FROM " . $this->table() . " WHERE valid = ? AND name = ? AND id != ?";
		return $this->db->query($sql, array(1,$name,$id))->result_object();
	}
}
?>